﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace ASCII.Common
{
    public enum TableDrawingPaletteEntry
    {
        Blank,
        Vertical,
        Horizontal,
        TopLeft,
        TopRight,
        BottomLeft,
        BottomRight,
        LeftTee,
        RightTee,
        TopTee,
        BottomTee,
        Cross
    }
    public class TableDrawingPalette
    {
        private Dictionary<TableDrawingPaletteEntry, byte> entries = new Dictionary<TableDrawingPaletteEntry, byte>();
        public byte this[TableDrawingPaletteEntry entry]
        {
            get
            {
                if (entries.ContainsKey(entry))
                {
                    return entries[entry];
                }
                throw new IndexOutOfRangeException();
            }
            set
            {
                entries[entry] = value;
            }
        }
        public static TableDrawingPalette V1H1Palette
        {
            get
            {
                TableDrawingPalette palette = new TableDrawingPalette();
                palette[TableDrawingPaletteEntry.Blank] = 32;
                palette[TableDrawingPaletteEntry.Vertical] = 179;
                palette[TableDrawingPaletteEntry.Horizontal] = 196;
                palette[TableDrawingPaletteEntry.TopLeft] = 218;
                palette[TableDrawingPaletteEntry.TopRight] = 191;
                palette[TableDrawingPaletteEntry.BottomLeft] = 192;
                palette[TableDrawingPaletteEntry.BottomRight] = 217;
                palette[TableDrawingPaletteEntry.LeftTee] = 195;
                palette[TableDrawingPaletteEntry.RightTee] = 180;
                palette[TableDrawingPaletteEntry.TopTee] = 194;
                palette[TableDrawingPaletteEntry.BottomTee] = 193;
                palette[TableDrawingPaletteEntry.Cross] = 197;
                return palette;
            }
        }
        public static TableDrawingPalette V1H2Palette
        {
            get
            {
                TableDrawingPalette palette = new TableDrawingPalette();
                palette[TableDrawingPaletteEntry.Blank] = 32;
                palette[TableDrawingPaletteEntry.Vertical] = 179;
                palette[TableDrawingPaletteEntry.Horizontal] = 205;
                palette[TableDrawingPaletteEntry.TopLeft] = 213;
                palette[TableDrawingPaletteEntry.TopRight] = 184;
                palette[TableDrawingPaletteEntry.BottomLeft] = 212;
                palette[TableDrawingPaletteEntry.BottomRight] = 190;
                palette[TableDrawingPaletteEntry.LeftTee] = 198;
                palette[TableDrawingPaletteEntry.RightTee] = 181;
                palette[TableDrawingPaletteEntry.TopTee] = 209;
                palette[TableDrawingPaletteEntry.BottomTee] = 207;
                palette[TableDrawingPaletteEntry.Cross] = 216;
                return palette;
            }
        }
        public static TableDrawingPalette V2H2Palette
        {
            get
            {
                TableDrawingPalette palette = new TableDrawingPalette();
                palette[TableDrawingPaletteEntry.Blank] = 32;
                palette[TableDrawingPaletteEntry.Vertical] = 186;
                palette[TableDrawingPaletteEntry.Horizontal] = 205;
                palette[TableDrawingPaletteEntry.TopLeft] = 201;
                palette[TableDrawingPaletteEntry.TopRight] = 187;
                palette[TableDrawingPaletteEntry.BottomLeft] = 200;
                palette[TableDrawingPaletteEntry.BottomRight] = 188;
                palette[TableDrawingPaletteEntry.LeftTee] = 204;
                palette[TableDrawingPaletteEntry.RightTee] = 185;
                palette[TableDrawingPaletteEntry.TopTee] = 203;
                palette[TableDrawingPaletteEntry.BottomTee] = 202;
                palette[TableDrawingPaletteEntry.Cross] = 206;
                return palette;
            }
        }
        public static TableDrawingPalette V2H1Palette
        {
            get
            {
                TableDrawingPalette palette = new TableDrawingPalette();
                palette[TableDrawingPaletteEntry.Blank] = 32;
                palette[TableDrawingPaletteEntry.Vertical] = 186;
                palette[TableDrawingPaletteEntry.Horizontal] = 196;
                palette[TableDrawingPaletteEntry.TopLeft] = 214;
                palette[TableDrawingPaletteEntry.TopRight] = 183;
                palette[TableDrawingPaletteEntry.BottomLeft] = 211;
                palette[TableDrawingPaletteEntry.BottomRight] = 189;
                palette[TableDrawingPaletteEntry.LeftTee] = 199;
                palette[TableDrawingPaletteEntry.RightTee] = 182;
                palette[TableDrawingPaletteEntry.TopTee] = 210;
                palette[TableDrawingPaletteEntry.BottomTee] = 208;
                palette[TableDrawingPaletteEntry.Cross] = 215;
                return palette;
            }
        }
    }
}
